#ifndef __ZY_TOOLS_H
#define __ZY_TOOLS_H
#include "main.h"

#define USING_CRC_TABLE

typedef struct
{
	#define RECORD_LEN	32
	uint16_t record[RECORD_LEN];
	uint16_t index;
	uint16_t avg;
	uint32_t sum;
	uint32_t lastTick;
}interval_t;


uint16_t CRC16(unsigned char *q, int len);
uint16_t Calc_Interval(interval_t* in);
uint16_t Calc_Adc_Average(uint16_t* buf,uint32_t chCount,uint32_t chIndex,uint32_t sampleCount,uint32_t shift);	
int Bytes_Hex(const uint8_t* src,uint8_t* dst,int32_t len);



#endif


